import { download } from '../utils';
import { captureVisibleTab } from '../tab';
import { GLOBAL_LIST_PARAM } from '../../../utils/const';
export default function seconed(port: chrome.runtime.Port) {
    port.onMessage.addListener(async msg => {
        let data = await captureVisibleTab(port.sender!.tab!.windowId, { format: 'png' });
        port.postMessage({ capture: data });
        let res = await download({
            url: data,
            filename: GLOBAL_LIST_PARAM.download.screen2 + 'a.png'
        });
        console.log(res);
        let res2 = await download({
            url: data,
            filename: GLOBAL_LIST_PARAM.download.screen + 'b.png'
        });
        console.log(res2);

    })
}